package com.github.wings27.interview.JavaCommonKnowledge;

/**
 * Project Name: common-interview-problems
 * Date Created: 2014/02/21 18:55
 *
 * @author Wings
 */
@SuppressWarnings({"UnnecessaryBoxing", "ConstantConditions", "NumberEquality"})
public class ConstantPool extends TryCatchFinally {
    private int id;

    public ConstantPool(int id) {
        this.id = id;
    }

    @Override
    public String toString() {
        return String.valueOf(this.id);
    }

    public static void main(String[] args) {

        int i = 127;
        int i0 = 127;
        Integer i1 = 127;
        Integer i2 = 127;
        Integer i3 = 0;
        Integer i4 = new Integer(127);
        Integer i5 = new Integer(127);
        Integer i6 = new Integer(0);

        Long l1 = 127l;
        Long l2 = 127l;

        Float f1 = 1.0f;
        Float f2 = 1.0f;
        Double d1 = 1.0;
        Double d2 = 1.0;

        Integer i7 = 128;
        Integer i8 = 128;

        System.out.println("i=i0\t" + (i == i0));
        System.out.println("i1=i2\t" + (i1 == i2));
        System.out.println("i0=i1\t" + (i0 == i1));
        System.out.println("i1=i2+i3\t" + (i1 == i2 + i3));
        System.out.println("i4=i5\t" + (i4 == i5));
        System.out.println("i4=i5+i6\t" + (i4 == i5 + i6));
        System.out.println("l1=l2\t" + (l1 == l2));
        System.out.println("f1=f2\t" + (f1 == f2));
        System.out.println("d1=d2\t" + (d1 == d2));
        System.out.println("i7=i8\t" + (i7 == i8));

        System.out.println();
    }
}
